package com.topisv.tms.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.topisv.tms.entity.ShippedBatch;

public interface ShippedBatchDao extends JpaSpecificationExecutor<ShippedBatch>,
		PagingAndSortingRepository<ShippedBatch, Long> {
	
	@Modifying
	@Query("delete from ShippedBatch sb where sb.batchCode=?1")
	void delete(String batchCode);

	ShippedBatch findByBatchCode(String batchCode);
	
	ShippedBatch findByBackupTaskCode(String backupTaskCode);
	
	List<ShippedBatch> findByCreateDateBetween(Date startDate,Date endDate);
	
	List<ShippedBatch> findByStatus(String status);
	
	List<ShippedBatch> findByStatusAndJobuuid(String status,String jobuuid);
	
	List<ShippedBatch> findByStatusAndCustomerCode(String status,String customerCode);

}
